

$(function () {
    //最新
    $.ajax({
        url: "http://127.0.0.1:3000/play/new",
        type: 'get',
        success: function (res) {
            console.log(res);
            for (var i = 0; i < 2; i++) {
                var arr=res[i]
                for (var j = 0; j < arr.length; j++) {
                    $('.kuw_xbx ul').append(
                        `<li>
                        <img class="kuw_ximg" src="${arr[j].img}" alt="">
                        <span>${arr[j].text}</span><br>
                        <span>￥${arr[j].price}</span><span><img src="./img/zan.png" alt=""> 3 <img src="./img/reply.png" alt=""> 3 </span>
                    </li>`
                    )
                }
            }
        }
    })

    //最热
    $.ajax({
        url: "http://127.0.0.1:3000/play/hot",
        type: 'get',
        success: function (res) {
            console.log(res);
            for (var i = 2; i < res.length; i++) {
                var arr=res[i]
                for (var j = 0; j < arr.length; j++) {
                    $('.kuw_rbx ul').append(
                        `<li>
                        <img class="kuw_rimg" src="${arr[j].img}" alt="">
                        <span>${arr[j].text}</span><br>
                        <span>￥${arr[j].price}</span><span><img src="./img/zan.png" alt=""> 3 <img src="./img/reply.png" alt=""> 3 </span>
                    </li>`
                    )
                }
            }
        }
    })





    //点击
    $('.kuw_t span').click(function () {
        var index = $(this).index()
        console.log(index);
        $('.kuw>li').eq(index - 1).show().siblings().hide()
        $(this).addClass('kuw_t_zi').siblings().removeClass()
    })
})